/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package sda.levelup.calculator.view;

import java.awt.Dimension;
import java.awt.LayoutManager;
import java.awt.Toolkit;
import javax.swing.Box;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import sda.levelup.calculator.model.ActionStorage;

/**
 *
 * @author Дима
 */
public class HistoryFrame extends JFrame
{
    private Toolkit t = Toolkit.getDefaultToolkit();
    private Dimension d = t.getScreenSize();
    private int x = (int)d.getWidth()/2;
    private int y = (int)d.getHeight()/2;
    private ActionStorage storage;

    public HistoryFrame(ActionStorage as) {
        storage=as;
        setDefaultCloseOperation(HIDE_ON_CLOSE);
        setSize(200, 200);
        setLocation(x, y);
        FillFrame();        
    }
    public void FillFrame(){
        MainPanel mp = new MainPanel();
        mp.fillPanel();
        add(mp);
    }
    
    class MainPanel extends JPanel{

        Box box = Box.createVerticalBox();

        public MainPanel() {
            add(box);
        }
        
                
        public void fillPanel(){
            for (int i = 0; i<storage.getMemory().size(); i++){
                JLabel l = new JLabel(storage.getMemory().get(i).toString());
               // JLabel l = new JLabel("sfsf");
                box.add(l);
            }
        }
        
    }
    
    
}
